Boltzmann samplers for random generation of lambda terms
نویسنده
چکیده
Randomly generating structured objects is important in testing and optimizing functional programs, whereas generating random λ-terms is more specifically needed for testing and optimizing compilers. For that a tool called QuickCheck has been proposed, but in this tool the control of the random generation is left to the programmer. Ten years ago, a method called Boltzmann samplers has been proposed to generate combinatorial structures. In this paper, we show how Boltzmann samplers can be developed to generate random λ-terms, but also other random data structures like trees. These samplers rely on a critical value which parameters the main random selector and which is exhibited here with explanations on how it is computed. Haskell programs are proposed to show how samplers are actually implemented.
منابع مشابه
Lambda-terms of Bounded Unary Height
We aim at the asymptotic enumeration of lambda-terms of a given size where the order of nesting of abstractions is bounded whereas the size is tending to infinity. This is done by means of a generating function approach and singularity analysis. The generating functions appear to be composed of nested square roots which exhibit unexpected phenomena. We derive the asymptotic number of such lambd...
متن کاملRandom generation of closed simply-typed $\lambda$-terms: a synergy between logic programming and Boltzmann samplers
A natural approach to software quality assurance consists in writing unit tests securing programmer-declared code invariants. Throughout the literature a great body of work has been devoted to tools and techniques automating this labour-intensive process. A prominent example is the successful use of randomness, in particular random typeable λ-terms, in testing functional programming compilers s...
متن کاملCounting and Generating Terms in the Binary Lambda Calculus (Extended version)
In a paper entitled Binary lambda calculus and combinatory logic, John Tromp presents a simple way of encoding lambda calculus terms as binary sequences. In what follows, we study the numbers of binary strings of a given size that represent lambda terms and derive results from their generating functions, especially that the number of terms of size n grows roughly like 1.963447954 . . .. In a se...
متن کاملCounting Environments and Closures
Environments and closures are two of the main ingredients of evaluation in lambdacalculus. A closure is a pair consisting of a lambda-term and an environment, whereas an environment is a list of lambda-terms assigned to free variables. In this paper we investigate some dynamic aspects of evaluation in lambda-calculus considering the quantitative, combinatorial properties of environments and clo...
متن کاملBoltzmann Samplers for v-balanced Colored Necklaces
This paper is devoted to the random generation of particular colored necklaces for which the number of beads of a given color is constrained (these necklaces are called v-balanced). We propose an efficient sampler (its expected time complexity is linear) which satisfies the Boltzmann model principle introduced by Duchon, Flajolet, Louchard and Schaeffer (7). Our main motivation is to show that ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/1404.3875 شماره
صفحات -
تاریخ انتشار 2014